#ifndef UART_TOOL_H
#define UART_TOOL_H

#include <QWidget>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QTimer>      // 用于定时器使用
#include <QScrollBar>  // 用于自动滚动
#include <QDateTime>   // 用于获取时间戳

namespace Ui {
class uart_tool;
}

class uart_tool : public QWidget
{
    Q_OBJECT

public:
    explicit uart_tool(QWidget *parent = nullptr);
    ~uart_tool();

private slots:
    void on_pushButton_clear_recv_clicked();

    void on_pushButton_clear_send_clicked();

    void on_pushButton_scan_uart_clicked();

    void on_pushButton_open_close_clicked();

    void on_pushButton_send_clicked();

    void readData();            // 读取串口数据

    void on_radioButton_send_char_clicked();

private:
    Ui::uart_tool *ui;
    QSerialPort *serial_test;//串口端口
    QTimer *timer;                          //定时器
    QString Sendtext,Receivetext;           //发送、接收缓存区
    long int SendByte,ReceByte;             //发送、接收字符数
    QStringList serialPortName;             //端口链表
};

#endif // UART_TOOL_H
